import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBProjectPopPage/YBZuZhiGuanLiQuanXianPage.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBMineModule/YBMineProvider/YBMineUserProvider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBNetWorkModule/YBAPi/YBAPi.dart';


class YBPersonDisPlayPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Scaffold(
        appBar: AppBar(
            elevation: 0,
            title: Text(YBChineseText.mineAuthInfoTitle,style: YBTextStyle.TextStyle30313320Medium),
            actions: [
              InkWell(
                child: Padding(
                  padding: EdgeInsets.only(right: YBTextStyle.adapterSize10),
                  child: Center(
                    child: Text(
                      YBChineseText.mineChongXinAuthTitle,
                      style: YBTextStyle.TextStyleA9AEB812,
                    ),
                  ),
                ),
                onTap: (){
                  YBZuZhiGuanLiQuanXianPage.showQiYeAndPersonalLiApi(context);
                },
              ),
            ],
        ),
        body: ChangeNotifierProvider(
          create: (context) => YBMineUserProvider()..getUserInfoData(),
          child: Consumer<YBMineUserProvider>(
              builder:(context,dataUserInfo,child){
                Widget containerWidget;
                if (dataUserInfo.mineUserInfoModel.certStatus == -1){
                  containerWidget =  Container(
                    alignment: Alignment.centerLeft,
                    height: YBTextStyle.adapterSize26,
                    color: YBColor.colorE6A23C.withOpacity(0.2),
                    child: Padding(
                      padding: EdgeInsets.only(left: YBTextStyle.adapterSize20),
                      child: Text(YBChineseText.mineAuthInfoShengHeingTitle,
                        style:YBTextStyle.TextStyleE6A23C13,
                      ),
                    ),
                  );
                }else if (dataUserInfo.mineUserInfoModel.certStatus == 1){
                  containerWidget =  Container(
                    alignment: Alignment.centerLeft,
                    height: YBTextStyle.adapterSize26,
                    color: YBColor.colorF56C6C.withOpacity(0.2),
                    child: Padding(
                      padding: EdgeInsets.only(left: YBTextStyle.adapterSize20),
                      child: Text(YBChineseText.mineAuthInfoBoHuiTitle,
                        style:YBTextStyle.TextStyleF56C6C13,
                      ),
                    ),
                  );
                }else if (dataUserInfo.mineUserInfoModel.certStatus == 2){
                  containerWidget =  Container(
                    alignment: Alignment.centerLeft,
                    height: YBTextStyle.adapterSize26,
                    color: YBColor.color67C23A.withOpacity(0.2),
                    child: Padding(
                      padding: EdgeInsets.only(left: YBTextStyle.adapterSize20),
                      child: Text(YBChineseText.mineAuthInfoYiAuthTitle,
                        style:YBTextStyle.TextStyle67C23A13,
                      ),
                    ),
                  );
                }

                return Column(
                  children: [
                    Container(
                      child: containerWidget,
                    ),
                    Expanded(
                      child: SingleChildScrollView(
                        child: Column(
                          children: [
                            Container(
                              height: YBTextStyle.adapterSize8,
                            ),
                            Container(
                              height: YBTextStyle.adapterSize58,
                              color: YBColor.white,
                              child: Padding(
                                padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                child: Row(
                                  children: [
                                    Container(
                                      child: Text(
                                        YBChineseText.mineAuthTypeTitle,
                                        style: YBTextStyle.TextStyle2F303314,
                                      ),
                                    ),
                                    Expanded(
                                      child: Container(
                                        alignment: Alignment.centerRight,
                                        child: Text(
                                          YBChineseText.minePersonAuthTitle,
                                          style: YBTextStyle.TextStyle2F303314,
                                        ),
                                      ),
                                    ),

                                  ],
                                ),
                              ),
                            ),
                            Container(
                              height: YBTextStyle.adapterSize8,
                            ),
                            Container(
                              color: YBColor.white,
                              child: Padding(
                                padding: EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                child: Column(
                                  children: [
                                    Container(
                                      child: InkWell(
                                        child: getPersonLoadInfo(YBChineseText.mineXingMingTitle, dataUserInfo.mineUserInfoModel.certLinkName??""),
                                        onTap: (){

                                        },
                                      ),
                                    ),
                                    Container(
                                      child: InkWell(
                                        child: getPersonLoadInfo(YBChineseText.mineShengfengHaoTitle, dataUserInfo.mineUserInfoModel.idDetail.idNo??""),
                                        onTap: (){

                                        },
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                            ),
                            Container(
                              height: YBTextStyle.adapterSize10,
                            ),
                            Container(
                              color: YBColor.white,
                              child: Column(
                                mainAxisAlignment: MainAxisAlignment.start,
                                crossAxisAlignment: CrossAxisAlignment.stretch,
                                children: [
                                  Container(
                                    height: YBTextStyle.adapterSize10,
                                  ),
                                  Container(
                                    child: Padding(
                                      padding: EdgeInsets.only(left:YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                      child: Text(
                                        YBChineseText.mineShengFengZhengZhaoPianTitle,
                                        style: YBTextStyle.TextStyle2F303314,
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              height: YBTextStyle.adapterSize15,
                              color: YBColor.white,
                            ),
                            Container(
                              color: YBColor.white,
                              child: Padding(
                                padding:EdgeInsets.only(left: YBTextStyle.adapterSize20,right: YBTextStyle.adapterSize20),
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: [
                                    Container(
                                      child: CachedNetworkImage(imageUrl:dataUserInfo.mineUserInfoModel.idDetail.idFrontUrl != null?"${YBApi.Base_image_URL}/${dataUserInfo.mineUserInfoModel.idDetail.idFrontUrl}":null),
                                    ),
                                    Container(
                                      width: YBTextStyle.adapterSize20,
                                    ),
                                    Container(
                                      child: CachedNetworkImage(imageUrl:dataUserInfo.mineUserInfoModel.idDetail.idBackUrl != null?"${YBApi.Base_image_URL}/${dataUserInfo.mineUserInfoModel.idDetail.idBackUrl}":null),
                                    ),
                                  ],
                                ),
                              ),
                            ),
                            Container(
                              color: YBColor.white,
                              height: YBTextStyle.adapterSize10,
                            ),
                            Container(
                              color: YBColor.white,
                              child:Row(
                                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                                crossAxisAlignment: CrossAxisAlignment.center,
                                children: [
                                  Container(
                                    child: Text(
                                      YBChineseText.minePersonZhengMianInfoTitle,
                                      style: YBTextStyle.TextStyleA9AEB812,
                                    ),
                                  ),
                                  Container(
                                    child: Text(
                                      YBChineseText.minePersonFanMianInfoTitle,
                                      style: YBTextStyle.TextStyleA9AEB812,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              color: YBColor.white,
                              height: YBTextStyle.adapterSize15,
                            ),
                          ],
                        ),
                      ),
                    ),
                  ],
                );
              }
          ),
        ),
      ),
    );
  }

  Widget getPersonLoadInfo(String title, String bodyTitle){
    return Container(
      height: 58,
      child: Row(
        children: [
          Container(
            child: Text(
              title,
              style: YBTextStyle.TextStyle2F303314,
            ),
          ),
          Expanded(
            child: Container(
              alignment: Alignment.centerRight,
              child: Text(
                bodyTitle,
                style: YBTextStyle.TextStyle2F303314,
              ),
            ),
          ),
        ],
      ),
    );
  }

}
